<script setup lang="ts">

import {useRoute} from "vue-router";
import {onMounted, ref} from "vue";
import router from "@/router/index.js";
import {getOneProjectAPI} from "@/apis/projectInfo.js";


const route=useRoute();
const projectInfo=ref({
  name:"",
  contact:"",
  address:"",
  createBy:"",
  lastUpdateBy:"",
  createTime:"",
  lastUpdateTime:"",
  phone:'',
  description:""

});

onMounted(async () => {
  if(route.params.id===null||route.params.id===undefined){
    await router.push("/manage/projectManager");
  }
  else {
    const res= await getOneProjectAPI(Number(route.params.id))
    projectInfo.value=res.data;
  }
})


</script>

<template>
  <div class="bread-container">
    <el-breadcrumb separator=">">
      <el-breadcrumb-item :to="{ path: `/` }">首页</el-breadcrumb-item>
      <el-breadcrumb-item :to="{path:`/manage/projectManager`}" >项目列表</el-breadcrumb-item>
      <el-breadcrumb-item  >项目详细页</el-breadcrumb-item>
    </el-breadcrumb>
  </div>

  <div class="divTable">
    <table class="table">
      <tbody>
      <tr>
        <td class="tableTitle" colspan="4" >项目信息</td>
      </tr>
      <tr>
        <td style="width: 250px;height: 15px;text-align: center;background: #EFF6FF;color: #242424;font-family: 微软雅黑,serif">项目名称</td>
        <td style="width: 350px;height: 15px;   text-align: center  ">{{projectInfo.name}}</td>
        <td style="width: 250px;height: 15px; text-align: center ;background: #EFF6FF"  >项目地址</td>
        <td style="width: 350px;height: 15px ; text-align: center   ">{{projectInfo.address}}</td>
      </tr>
      <tr>
        <td style="width: 250px;height: 15px;text-align: center;background: #EFF6FF">联系电话</td>
        <td style="width: 350px;height: 15px;text-align: center  ">{{projectInfo.phone}}</td>
        <td style="width: 250px;height: 15px;text-align: center ;background: #EFF6FF"  >项目联系人</td>
        <td style="width: 350px;height: 15px;text-align: center   ">{{projectInfo.contact}}</td>
      </tr>
      <tr>
        <td>备注</td>
        <td colspan="3">{{projectInfo.description}}</td>
      </tr>
      </tbody>
    </table>
  </div>
</template>

<style scoped lang="scss">
.bread-container {
  padding: 25px 10px;
  margin-left: 10px;
}
.divTable {
  position: static;
  top: 150px;
  bottom: 0;
  left: 300px;
  right: 0;
  margin: auto;
}
table {
  margin-left: 10px;
}
table, td,tr{
  border: 1px solid #44a8da;
  text-align: center;
  border-spacing: 0;
  border-collapse: collapse;
  height: 45px;
}

.tableTitle{
  border-right: 0 none;
  border-left: 0 none;
  text-align: center;
  font-size: large;
  font-weight: bold;
}

.demo-image__error .image-slot {
  font-size: 30px;
}
.demo-image__error .image-slot .el-icon {
  font-size: 30px;
}
.demo-image__error .el-image {
  width: 100%;
  height: 200px;
}
</style>